Skip to content

Conversation

@richardpark-msft
Copy link
Member

@richardpark-msft richardpark-msft commented Dec 6, 2025

Fix for breakage mentioned here: #25727

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes brittle assertions that checked for exact token counts in chat completion tests. The test now validates that token usage values are populated (greater than zero) rather than matching specific values, making the tests more resilient to model changes.

Key Changes:

  • Replaced exact token count assertions with checks that verify token counts are positive values
  • Removed model-specific hard-coded values that could cause test failures when models change

// let's just make sure that the #'s are filled out.
require.Greater(t, resp.Usage.CompletionTokens, int64(0))
require.Greater(t, resp.Usage.PromptTokens, int64(0))
require.Greater(t, resp.Usage.TotalTokens, int64(0))
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using require.NotZero instead of require.Greater(t, ..., int64(0)) for consistency with similar checks in client_completions_test.go (lines 33-35). Both approaches are functionally equivalent, but NotZero is more concise and aligns with the existing pattern in the codebase.

Suggested change
require.Greater(t, resp.Usage.TotalTokens, int64(0))
require.NotZero(t, resp.Usage.TotalTokens)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant